FROM openjdk:17-jdk-slim

ARG PORT
ARG JAR_NAME

ENV PORT=${PORT}
ENV JAR_NAME=${JAR_NAME}

RUN mkdir -p /app
WORKDIR /app
EXPOSE ${PORT}
ADD ./target/${JAR_NAME} app.jar
ADD ./target/bin bin
RUN chmod +x bin/startup.sh
RUN chmod +x bin/shutdown.sh
VOLUME ["/app/config","/app/resources","/app/logs","/app/lib","/app/app.jar"]
WORKDIR "/app/bin"
CMD ./startup.sh -p $PORT